{include file = $smarty.const.APPLICATION_PATH|cat:"/application/views/header.html"}
{literal}
<script type="text/javascript">
    $(function(){
        $('.assortment').hover(function(){
            $('.assort_list').stop().fadeIn();
        },function(){
            $('.assort_list').stop().fadeOut();
        });
    });
</script>
<script>
    $(document).delegate(".quotes","click",function(){
        var buy_id = $(this).attr("buy_id");
        var product_id = $(this).attr("product_id");
        var cate_name = $(this).attr("cate_name");
        var product_name = $(this).attr("product_name");
        var brand_name = $(this).attr("brand_name");
        var num = $(this).attr("num");
        var price = $(this).attr("price");
        var delivery_area = $(this).attr("delivery_area");
        var p_id = $(this).attr("p_id");
        var delivery_time =$(this).attr("delivery_time");
        if(delivery_time.length==0){ delivery_time="---" }
        var user_id = 0;
        quote_htmls(buy_id,user_id,product_id,cate_name,product_name,brand_name,num,price,delivery_area,p_id,delivery_time);
        $('.overlay-close').click(function(){
            $(".remove").hide();
        })
    });

    $(document).delegate(".popup_btn", "click", function(e){
        e.preventDefault();
        var buy_id = $("input[name=buy_id]").val();
        var product_id = $("input[name=product_id]").val();
        var price = $("input[name=price]").val();
        var num = $("input[name=num]").val();
        var deliveryarea = $("input[name=deliveryarea]").val();
        var content = $("#contents").val();
        var user_id = $("input[name=user_id]").val();
        var delivery_time = $("input[name=delivery_time]").val();
        var url = "/json/save_quote";
        $.post(url, {
            price:price,
            num:num,
            delivery_area:deliveryarea,
            buy_id: buy_id,
            user_id:user_id,
            product_id:product_id,
            content: content,
            delivery_time:delivery_time
        },function(data){
            var data = eval("("+data+")");
            var code = data.code;
            var msg = data.msg;
            if(code == 8){
                var html = "<div style='color:#007750; text-align: center; padding: 20px 0px;'>"+msg+"</div>" ;
                $(".brandMsgTips").html(html);
                window.location.reload();
            }else{
                $(".quote_msg").html(msg);
            }
        });

    });


    function quote_htmls(buy_id,user_id,product_id,cate_name,product_name,brand_name,num,price,delivery_area,p_id,delivery_time){
        var html = "<div class=\"mui-dialog-mask remove\" ></div>";
        html += "<div class=\"mui-dialog remove\" style=\'width:500px; height: 460px; left:50%; top:50%;margin-top:-240px;position:fixed;margin-left:-250px; \' >";
        html += "<a href=\"javascript:void(0)\" class=\"overlay-close\"></a>";
        html += "<div class=\"mui-diglog-wrap\">";
        html += "<div class=\"mui-dialog-header\">我要报价</div>";
        html += "<div class=\"mui-dialog-body\">";
        html += "<div class=\"brandMsgTips\" style='margin: 5px 15px; padding: 0px;'>";
        html += "<form action='/json/save_quote' method='post'>";
        html += " <input type=\"hidden\" name=\"product_id\" class=\"product_id\" value=\""+product_id+"\">";
        html += " <input type=\"hidden\" name=\"buy_id\" class=\"buy_id\" value=\""+buy_id+"\">";
        html += " <input type=\"hidden\" name=\"user_id\" class=\"user_id\" value=\""+user_id+"\">";
        html += " <input type=\"hidden\" name=\"p_id\" class=\"p_id\" value=\""+p_id+"\">";
        html += " <input type=\"hidden\" name=\"delivery_time\" class=\"delivery_time\" value=\""+delivery_time+"\">";
        html += "<h3 class=\"orange tac fwb\">求购：<span>"+cate_name+' '+product_name+' '+brand_name+' '+num+' '+price+' '+delivery_area+"</span></h3>";
        html +="<ul class=\"mui_dl_list\">";
        html += "<li>　　价格：<input type=\"text\" class=\"popup_text\" value="+price+" name=\"price\"></li>";
        html += "<li>　　数量：<input type=\"text\" class=\"popup_text\" value="+num+" name=\"num\"></li>";
        html += "<li>　交货地：<input type=\"text\" class=\"popup_text\" value='"+delivery_area+"' name=\"deliveryarea\"></li>";
        html += "<li>交货时间：<input type=\"text\" class=\"popup_text\" value="+delivery_time+" name=\"delivery_time\"></li>";
        html += "<li>　　备注：<textarea  class=\"popup_text\" name=\"content\" id=\"contents\"></textarea></li>";
        html += "<li class=\"pl30p \"><input class=\"popup_btn\" type='submit' value='提交报价'></li>";
        html +="</u>";
        html += "<div class='quote_msg red'></div>";
        html += "</div>";
        html += "</div>";
        html += "</div>";
        html += "</div>";
        html += "</form>";
        html += "<div class=\"mui-dialog-skin\"></div>";
        $("body").append(html);
    }
</script>
<script type="text/javascript" src="/js/user.js"></script>
<style>
    .assort_list{display: none;}
</style>
{/literal}

<div class="help_center">

    <div class="crumbs_tmg" style="padding-top:0;">当前位置：<a href="/index/index">首页</a><i class="ffs">></i><span class="blue">会员中心</span></div>

    {include file = $smarty.const.APPLICATION_PATH|cat:"/application/views/menu_title.html"}
    <div class="member_center">
        <div class="mc_user">
            <div class="mc_user_left">
                <p class="mc_user_text"><i></i>{$date['0']}年{$date['1']}月{$date['2']}日 尊敬的<span class="blue ml5">
                    {if $userinfo.realname neq ''}
                    {$userinfo.realname}
                    {if $userinfo.sex eq 'W'}
                    女士
                    {else}
                    先生
                    {/if}
                    {else}
                    {$userinfo.moblie}
                    {/if}
                </span>，欢迎来到塑料交易网会员中心！</p>
                <h4 class="fs16 blue mt15">用户信息</h4>
                <p class="pt10">公司名称：{$userinfo.business_name}</p>
                <p class="lh30 pt5">联系人：{$userinfo.contacts}</p>
            </div>
            <div class="mc_user_right">
                <div class="fl">
                    <p class="fs16 blue mt15">我的客户经理</p>
                    <p class="pt10">客户经理：冯丽姣</p>
                    <p class="lh30">联系电话：021-61657142</p>
                    <p class="lh30">QQ咨询：<a href="http://wpa.qq.com/msgrd?v=3&uin=2853708775&site=qq&menu=yes" target="_blank"><span class="orange">2853708775</span><img class="ml5" src="images/login_qq.png" /></a></p>
                </div>
                <p class="fr"><img src="images/temp/temp6.jpg" width="115" height="115" /></p>
            </div>
        </div>




        <div class="purchase_supply">
            <div class="ps_icon">
                <div class="ps_icon_ic">
                    <p></p>
                </div>
                <div class="ps_icon_text">
                    <p class="fs18">我的求购订单：<span class="blue">{$buycount}条</span></p>
                    <p class="pt10"><a href="/user/buyorder" class="orange">查看求购订单></a></p>
                </div>
            </div>

            <div class="ps_icon">
                <div class="ps_icon_ic pii">
                    <p></p>
                </div>
                <div class="ps_icon_text">
                    <p class="fs18">我的供应订单：<span class="blue">{$salecount}条</span></p>
                    <p class="pt10"><a href="/user/saleorder" class="orange">查看供应订单></a></p>
                </div>
            </div>

        </div>




        <div class="supply_wrap">
            <h3 class="user_title" style="margin:0;">
                <ul>
                    <li class="curr">最新求购信息</li>
                </ul>
            </h3>
            <ul class="news_supply">
                {foreach from=$buylist key=key item=item}
                <li>
                    <p class="fl">求购：<span class="pr10">{$item.cate_name}</span><span class="pr10">{$item.product_name}</span><span class="pr10">{$item.brand_name}</span><span class="pr10">{$item.num}吨</span><span class="pr10">{$item.delivery_area}</span><span class="pr5 orange">{$item.price}元/吨</span></p>
                    <a  class="fr quotes" href="javascript:void (0)" product_id="{$item.product_id}" cate_name="{$item.cate_name}" product_name="{$item.product_name}" brand_name="{$item.brand_name}" num="{$item.num}"  p_id="{if !empty($item.p_id)}{$item.p_id}{/if}" delivery_time="{if !empty($item.delivery_time)}{$item.delivery_time}{/if}"  price="{$item.price}" delivery_area="{$item.delivery_area}" buy_id="{if !empty($item.id)}{$item.id}{/if}">我要报价</a>
                </li>
                {/foreach}
            </ul>
        </div>


    </div>
</div>

{include file = $smarty.const.APPLICATION_PATH|cat:"/application/views/footer.html"}